﻿using System;
using System.Linq;
using System.Text;

namespace Se.Framework.Common.Extentions
{
    public static class StringExtentions
    {
        public static string SplitByUppercase(this string str)
        {
            StringBuilder builder = new StringBuilder();
            str = str.Trim().Replace(" ", "");
            builder.Append(str[0]);
            char current;
            for (int i = 1; i < str.Length; i++)
            {
                current = str[i];
                if (Char.IsUpper(current))
                {
                    builder.Append(" ");
                }
                builder.Append(current);
            }
            return builder.ToString();
        }

        public static StringBuilder AppendLineFormat(this StringBuilder stringBuilder, string format, params object[] args)
        {
            return stringBuilder.AppendFormat(format, args).AppendLine();
        }
    }
}